{% extends "base.html" %} {% block title %}Список пользователей{% endblock %} {% load filters %} {% block content %} 
<table id="users" class="listing">
  <thead>
    <tr>
      <th>
         Фамилия и имя 
      </th>
      <th>
         IP 
      </th>
      <th>
         Дата регистрации 
      </th>
      <th>
         Информация о тарифе 
      </th>
      <th>
         Баланс 
      </th>
      <th>
         Статус аккаунта 
      </th>
      <th>
         Последнее подключение 
      </th>
    </tr>
  </thead>
  <tbody>
     {% for user in user_list %} 
    <tr class="{% cycle 'odd' 'even' %}">
      <td class="username">
        <a href="{% url userinfo user.user.id %}">{{ user }}</a>
        <!-- -->
      </td>
      <td class="IP">
         {{ user.ip }} 
      </td>
      <td class="reg_date">
         {{ user.user.date_joined|date:"d.m.Y" }} 
      </td>
      <td class="tariff_info">
         <a class="tariff_name" href="{% url change_tariff statuser=user.user.id %}">{{ user.tariff }}</a>

{% if user.tariff.cost %}
{% if user.abon_paid %}
<span class="positive-balance">до {{ user.paid_until|date:"d.m.Y, H:i" }}</span>
{% else %}
<span class="negative-balance">тариф не оплачен</span>
{% endif %}

{% endif %}


{% if user.prepaidpacket_set.all %}
        <ul class="tariff_info">
           {% for packet in user.prepaidpacket_set.all %} 
          <li>
             {{ packet.prepaid|human_bytes }} трафика "{{ packet.traffic_category }}" 
          </li>
           {% endfor %} 
        </ul>
         {% endif %} 
      </td>
      <td class="balance">
        <a href='{% url pay statuser=user.user.id %}'>{{ user.balance|color_balance }}</a>
      </td>
      <td class="inet_status">
          {% if user.blocked %}<span class="negative-balance">Заблокирован</span>{% else %}
         {% if user.inet %}<span class="active">Включён</span>{% else %}<span class="inactive">Выключен</span>{% endif %}{% endif %}
      </td>
      <td class="last_activity">
        {{ user.last_activity|time2str }}
      </td>
    </tr>
     {% endfor %} 
  </tbody>
</table>
 {% endblock %} 
